package com.fly.order.serivce.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.fly.common.model.OrderEntity;
import com.fly.order.dao.OrderMapper;
import com.fly.order.serivce.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description 订单业务实现
 * @author: liying.fu
 * @Date: 2018/11/24 下午4:47
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    /**
     * 根据用户主键获取订单信息
     * @param userId 用户主键
     * @return 订单信息
     */
    @Override
    public List<OrderEntity> queryOrderByUserId(Long userId) {
        EntityWrapper<OrderEntity> condition = new EntityWrapper<>();
        condition.eq("user_id", userId);
        return orderMapper.selectList(condition);
    }
}
